package components{
	
	import flash.events.Event;
	
	import mx.collections.ArrayList;
	import mx.containers.Canvas;
	
	public class ProcessCanvas extends Canvas{
		
		private var activityLabels:ArrayList;
		
		private var activityLines:ArrayList;
		
		private static var grapWidth: Number = 80;
		
		public function ProcessCanvas(){
			this.addEventListener(Event.COMPLETE, onInitialize);
			this.addEventListener(Event.RESIZE, onInitialize);
			
			activityLabels=new ArrayList();
			activityLines=new ArrayList();
			
		}
		
		internal function onInitialize(event: Event): void{
				this.graphics.clear();
				//填充背景
				this.graphics.beginFill(0xFFFFFF);
				this.graphics.drawRect(0, 0, this.width, this.height);
				this.graphics.endFill();
				
				this.graphics.lineStyle(1, 0xBBBBBB);
				//画横线
				var i : int = 0;
				var totalLength: Number = 0;
				while(totalLength <= this.height){
					this.graphics.moveTo(0, grapWidth * i);
					this.graphics.lineTo(this.width, grapWidth * i);
					totalLength = grapWidth * i;
					i ++;
				}
				
				//变量清零
				totalLength = 0;
				i = 0;
				
				//画竖线
				while(totalLength <= this.width){
					this.graphics.moveTo(grapWidth * i, 0);
					this.graphics.lineTo(grapWidth * i, this.height );
					totalLength = grapWidth * i;
					i ++;
				}
		}
		
		public function getLabels():ArrayList{
			return this.activityLabels;
		}
		
		public function setLabels(value:ArrayList){
			this.activityLabels=value;
		}
		
		public function getLines():ArrayList{
			return this.activityLines;
		}
		
		public function setLines(value:ArrayList){
			this.activityLines=value;
		}

	}
}